window.addEventListener('keydown',
function(event){
    let keyCode=event.keyCode;
    let audio=document.querySelector(`audio[data-key="${keyCode}"]`);
    // console.log(keyCode);
    if(!audio) return ;
    audio.play();
    let key=document.querySelector(`.key[data-key="${keyCode}"]`);
  if(!key) return;
key.classList.add('playing');
//定时器
// setTimeout(function(){
// console.log('-----');
// key.classList.remove('playing');
// },1000)

})
const keys=document.querySelectorAll('.key');
console.log(keys);
for(let k of keys){
    // console.log(key);
    k.addEventListener('transitionend',function(event){
    console.log('......');
    event.target.classList.remove('playing');
    })
}